CREATE OR REPLACE TRIGGER payroll_load_trigger
Before INSERT ON payroll_load
FOR EACH ROW
BEGIN
	DBMS_OUTPUT.PUT_LINE('BEFORE');
	INSERT INTO NEW_TRANSACTIONS
	VALUES (WKIS_SEQ.NEXTVAL,:NEW.payroll_date,'Payroll credits to '||:NEW.employee_id,2050,'C',:NEW.amount);
	
	INSERT INTO NEW_TRANSACTIONS
	VALUES (WKIS_SEQ.CURRVAL,:NEW.payroll_date,'Payroll debits to '||:NEW.employee_id,4045,'D',:NEW.amount);
	
	:NEW.status := 'G';
	
EXCEPTION
	WHEN OTHERS THEN
		:NEW.status := 'B';
END;
/
